Skip to main content
This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

HCL Notes/Domino 8.5 Forum (includes Notes Traveler)

Previous Next
Subject: Trying to read Active Directory using lotusscript
Feedback Type: Question
Product Area: Other
Technical Area: Application Development
Platform: Windows
Release: 8.5.2
Reproducible: Always

I am trying to read/query active directory using lotusscript. but i am getting an error when i am trying to excute -->Set objRecordSet = objCommand.Execute .

Error is "Active Directory: A Referral Was Returned From The Server"

here is the code

Dim objConnection As Variant
Dim objCommand As Variant
Dim objRecordSet As Variant

Const ADS_SCOPE_SUBTREE = 2


Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE


'Modify the Next line's dc and username (sAMAccountName) to match your environment
objCommand.CommandText = "<GC://dc=usdcserver,dc=com>;" & _
"(&(objectCategory=person)(objectClass=user)" & _
"(sAMAccountName=johndoe));" & _
"sAMAccountName, distinguishedName;subtree"



Set objRecordSet = objCommand.Execute

If objRecordSet.RecordCount = 0 Then
MsgBox "The sAMAccountName is not in use."
Else
While Not objRecordset.EOF
MsgBox "sAMAccountName = " & _
objRecordset.Fields("sAMAccountName").value
MsgBox "distinguishedName = " & _
objRecordset.Fields("distinguishedName").value
objRecordset.MoveNext
Wend
End If

objConnection.Close



objRecordSet.close


Feedback number WEBB8JRRYT created by ~Mario Zekgerotex on 07/14/2011

Status: Open
Comments:

Trying to read Active Directory usi... (~Mario Zekgerot... 14.Jul.11)
. . Trying to read Active Directory usi... (~Judy Fezweberg... 15.Jul.11)
. . . . Trying to read Active Directory usi... (~Mario Zekgerot... 15.Jul.11)
. . . . . . you may want to try the microsoft f... (~John Reniskiik... 15.Jul.11)
. . . . . . . . resolved (~Mario Zekgerot... 15.Jul.11)
. . . . . . . . . . objRecordSet.RecordCount = 0 and ty... (~Mario Zekgerot... 15.Jul.11)
. . . . . . . . . . . . I think you need unrestricted. (~John Reniskiik... 15.Jul.11)




Printer-friendly

Search this forum

Member Tools


RSS Feeds

 RSS feedsRSS
All forum posts RSS
All main topics RSS